//
//  LYScreenBar.m
//  artist
//
//  Created by Jay_Apple on 16/4/12.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYScreenBar.h"

@interface LYScreenBar ()

@property (weak, nonatomic) IBOutlet UIButton *subBtn;
@property (weak, nonatomic) IBOutlet UIButton *nearByBtn;
@property (weak, nonatomic) IBOutlet UIButton *sortBtn;

@property (assign, nonatomic) BOOL commentSeletion;

@property (assign, nonatomic) BOOL distanceSelection;

@end

@implementation LYScreenBar


#pragma mark - 筛选点击


- (void)awakeFromNib{

    //默认排序
    self.orderType = LYOrderTypeDefault;

}


- (IBAction)screenBarBtnOnclick:(UIButton *)sender {
    
    switch (sender.tag) {
        case SceenTypeSub:
            
            break;
        case SceenTypeEva:
            
            self.commentSeletion = !self.commentSeletion;
            
            if (self.commentSeletion) {
//                self.orderType = LYOrderTypeLow;
            }else{
//                self.orderType = LYOrderTypeHeight;
            }
            
            break;
        case SceenTypeDistance:
            
            self.distanceSelection = !self.distanceSelection;
            
            if (self.distanceSelection) {
//                self.orderType = LYOrderTypeFar;
            }else{
                
//                self.orderType = LYOrderTypeNear;
            }
            
            
            break;
    }
    
    
    if (self.block) {
        self.block(sender.tag);
    }
    
    /*
    [UIView animateWithDuration:0.3 animations:^{
        if (sender != self.subBtn) {
     
//            [self backToNormal];
            
        }
        
//        sender.imageView.transform = CGAffineTransformRotate(sender.imageView.transform, M_PI);
        
    }completion:^(BOOL finished) {
        
        


    }];
    */
    
}


- (void)backToNormal{

    [UIView animateWithDuration:0.3 animations:^{
        
            
            self.subBtn.imageView.transform = CGAffineTransformIdentity;
            
        }];

}


- (void)setSubTitle:(NSString *)subTitle{

    _subTitle = subTitle;
    
    [self.subBtn setTitle:_subTitle forState:UIControlStateNormal];
}


- (void)setNearByTitle:(NSString *)nearByTitle {
    _nearByTitle = nearByTitle;
    [self.nearByBtn setTitle:_nearByTitle forState:UIControlStateNormal];
}


- (void)setSortTitle:(NSString *)sortTitle {
    _sortTitle = sortTitle;
    [self.sortBtn setTitle:sortTitle forState:UIControlStateNormal];
}

@end
